<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp"%>
<%
	Message msg = new Message();
	//获取检验记录根据就诊卡号
	String cardNo = input.getDesc("cardNo","11080380");//就诊卡号

	
	StringBuffer sb = new StringBuffer();
	sb.append("'-20'");
	List<Map> list = QBuilder.db("basedb").queryHql("select new map(blh as blh , cardno as cardno) from ZY_BRXXK where  cardno = '"+cardNo+"' ");
	if(list == null || list.size() == 0){//没有去门诊查
		list = QBuilder.db("basedb").queryHql("select new map(blh as blh , cardno as cardno) from SF_BRXXK where  cardno = '"+cardNo+"' ");
	}else{
		
		if(list !=null && list.size() != 0 ){
			 for(Map map : list){
				 sb.append(",");
				 sb.append("'");
				 sb.append(map.get("blh").toString());
				 sb.append("'");
			 }
			 
		}
		list = QBuilder.db("basedb").queryHql("select new map(blh as blh , cardno as cardno) from SF_BRXXK where  cardno = '"+cardNo+"' ");
	}
	if(list !=null && list.size() != 0 ){
			 for(Map map : list){
				 sb.append(",");
				 sb.append("'");
				 sb.append(map.get("blh").toString());
				 sb.append("'");
			 }
			 
	}
	if(sb.toString().equals("'-20'")){//没有去门诊查
	
		sb.append(",'"+cardNo+"'");

	}
	System.out.println(sb);
	 

	
	List lis = QBuilder.db("lisdb").queryHql("select new map (regNo as regNo , reportNo as reportNo ,applyDate as applyDate , executDate as executDate , reportDate as reportDate , testCategCode as testCategCode , testCategName as testCategName , doctorCode as doctorCode , doctorName as doctorName ) from check where blh in(" + sb.toString() + ")");
	
	msg.put("errcode",0);
	msg.put("data",lis);
	
	out.println(msg);
%>